package com.useeinfo.oa.common.utils.Jedis;

import redis.clients.jedis.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: YiYouFuPlatform
 * @author: Taogq
 * @createDate: 2019-01-24
 * @createTime: 14:55:10
 */
public class JedisTools {

    static  String url = "localhost";
    static  int port = 6379;
    private Jedis jedis;//非切片额客户端连接
    public JedisTools()
    {
        initRedis();

    }


    public void initRedis(){
        jedis = new Jedis(url,port);
    }

    public void setKey(String key,String value){
        jedis.set(key,value);
        //jedis.expire(key,360000);//设置缓存时间
    }

    public String getKey(String key){
        return jedis.get(key);
    }

    public Jedis getJedis() {
        return jedis;
    }

    public void setJedis(Jedis jedis) {
        this.jedis = jedis;
    }

    public void deleteKey(String key){
        jedis.del(key);
    }

    public static void main(String[] args) {
        JedisTools jedisTools = new JedisTools();
        System.out.println(jedisTools.getKey("bd5876a2-bbfb-4a19-afa2-9f573ce87134"));
    }
}
